import React, { Component } from 'react';
import {ToTopStyled} from 'styled/ToTopStyled.js'
class ToTop extends Component {

    // componentDidMount() {
    //     console.log(window)
    //     document.addEventListener("scroll",this.handleScroll)
    // }
    
    // handleScroll = ()=>{
    //     console.log(1)
    //     this.ListView.scrollTop = 0;
    //     console.log(window.scrollY)

    // }

     

    // 置顶
    ToTop(){
        console.log(document.body.scrollTop)
        document.documentElement.scrollTop = "100px"
        console.log(window.screenTop)
    }

    
//  constructor(props){
//     super(props)
//     this.state = {};
//     this.scrollTop = 0;
//     this.handleScroll = this.handleScroll.bind(this)

// }





    render() {
        return (
            <ToTopStyled >
                <i ref={el => (this.ListView = el)} onClick={()=>{this.ToTop()}} className="iconfont icon-zhiding"></i>
            </ToTopStyled>
        );
    }
}

export default ToTop;